<#import "../template.ftl" as t/>
<@t.html ; part>
    <#if part="head">
        <link href="<@spring.url "/resources/plugins/bootstrap-select/bootstrap-select.min.css"/>" rel="stylesheet">
    </#if>

    <#if part="body">

        <div class="row">
            <div class="panel">
                <div class="panel-body">
                    <div class="col-lg-6">
                        <div class="panel-heading">
                            <h3 class="panel-title">企业基本信息</h3>
                        </div>
                        <form class="panel-body form-horizontal form-padding">
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-text-input"><input type="checkbox" name="checkbox" value="单位名称"/> 单位名称</label>
                                <div class="col-md-9">
                                    <input type="text" id="companyName" name="companyName" value="${(companyInfo.name)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="社会信用代码"/>社会信用代码</label>
                                <div class="col-md-9">
                                    <input type="text" id="creditCode" name="creditCode" value="${(companyInfo.creditCode)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="法定代表人"/>法定代表人</label>
                                <div class="col-md-9">
                                    <input type="text" id="operName" name="operName" value="${(companyInfo.operName)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="注册地址"/>注册地址</label>
                                <div class="col-md-9">
                                    <input type="text" id="address" name="address" value="${(companyInfo.address)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="用电地址"/>用电地址</label>
                                <div class="col-md-9">
                                    <input type="text" id="elecFor" name="elecFor" value="${(companyInfo.elecFor)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="联系人"/>联系人</label>
                                <div class="col-md-9">
                                    <input type="text" id="contractName" name="contractName" value="${(companyInfo.contractName)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="联系人电话"/>联系人电话</label>
                                <div class="col-md-9">
                                    <input type="text" id="contractPhone" name="contractPhone" value="${(companyInfo.contractPhone)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="微信号"/>微信号</label>
                                <div class="col-md-9">
                                    <input type="text" id="wxNum" name="wxNum" value="${(companyInfo.wxNum)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="地理区域"/>地理区域</label>
                                <div class="col-md-3">
                                    <select data-placeholder="请选择地级市" class="selectpicker" id="parentId" tabindex="2">
                                        <#if cityList??>
                                            <#list cityList as c>
                                                <option value="${c.id}" <#if city?? && (c.id==city.parentId || c.id==city.id)>selected="selected"</#if> >${c.name}</option>
                                            </#list>
                                        </#if>
                                    </select>
                                </div>
                                <div class="col-md-3">
                                    <select data-placeholder="请选择区域" class="selectpicker" id="cityId" tabindex="2">
                                        <#if areaList??>
                                            <#list areaList as c>
                                                <option value="${c.id}" <#if city?? && c.id==city.id>selected="selected"</#if> >${c.name}</option>
                                            </#list>
                                        </#if>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="购电结算单位"/>购电结算单位</label>
                                <div class="col-md-9">
                                    <input type="text" id="powerSupply" name="powerSupply" value="${(city.powerSupply)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="注册资本"/>注册资本</label>
                                <div class="col-md-9">
                                    <input type="text" id="capital" name="capital" value="${(companyInfo.capital)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="col-lg-6">
                        <div class="panel-heading">
                            <h3 class="panel-title">企业详细用电信息</h3>
                        </div>
                        <form class="panel-body form-horizontal form-padding">
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-text-input"><input type="checkbox" name="checkbox" value="电压等级"/>电压等级（千伏）</label>
                                <div class="col-md-9">
                                    <select data-placeholder="请选择电压等级" class="selectpicker" id="voltageStep" tabindex="2">
                                        <option value="0.4" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="0.4") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="0.4")>selected="selected"</#if> >0.4</option>
                                        <option value="0.6" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="0.6") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="0.6")>selected="selected"</#if> >0.6</option>
                                        <option value="10" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="10") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="10")>selected="selected"</#if> >10</option>
                                        <option value="20" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="20") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="20")>selected="selected"</#if> >20</option>
                                        <option value="35" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="35") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="35")>selected="selected"</#if> >35</option>
                                        <option value="110" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="110") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="110")>selected="selected"</#if> >110</option>
                                        <option value="220" <#if ((detailInfo.voltageStep)?? && detailInfo.voltageStep=="220") || ((companyBak.voltageStep)?? && companyBak.voltageStep=="220")>selected="selected"</#if> >220</option>
                                    </select>
                                    <span> （千伏）</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="户号个数"/>户号个数</label>
                                <div class="col-md-9">
                                    <#if (detailInfo.elecAccountNum)??>
                                        <#assign accounts = detailInfo.elecAccountNum?split(",") >
                                        <input type="text" id="accountNum" name="accountNum" value="${(accounts?size)!(0)}" class="form-control" placeholder="">
                                    <#elseif (companyBak.elecAccountNum)??>
                                        <input type="text" id="accountNum" name="accountNum" value="${companyBak.elecAccountNum}" class="form-control" placeholder="">
                                    <#else>
                                        <input type="text" id="accountNum" name="accountNum" class="form-control" placeholder="">
                                    </#if>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="用电户号"/>用电户号</label>
                                <div class="col-md-9">
                                    <#if (detailInfo.elecAccountNum)??>
                                        <textarea rows="3" id="elecAccount" name="elecAccount" class="form-control">${(detailInfo.elecAccountNum)!}</textarea>
                                    <#else>
                                        <textarea rows="3" id="elecAccount" name="elecAccount" class="form-control" placeholder=""></textarea>
                                    </#if>
                                </div>
                            </div>
                            <div class=" form-group row">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="用户容量总计"/>用户容量总计</label>
                                <div class="col-md-7 input-group mar-btm">
                                    <input type="text" class="form-control" id="transformerCapacity" name="transformerCapacity" value="${(detailInfo.transformerCapacity)!}" class="form-control" placeholder="">
                                    <span class="input-group-addon">KVA(千伏安)</span>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="用户预估电量"/>用户预估电量（年）</label>
                                <div class="col-md-7 input-group mar-btm">
                                    <input type="text" id="elecConsumption" name="elecConsumption" value="<#if (detailInfo.elecConsumption)??>${(detailInfo.elecConsumption)!}<#else>${(companyBak.elecConsumption)!}</#if>" class="form-control" placeholder="">
                                    <span class="input-group-addon">万kW·h(万度)/年</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="行业类别"/>行业类别</label>
                                <div class="col-md-9">
                                    <select data-placeholder="请选择行业列表" class="selectpicker" id="detailCategory" name="detailCategory" tabindex="2">
                                        <option value="工业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="工业")>selected="selected"</#if> >工业</option>
                                        <option value="商业、住宿和餐饮业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="商业、住宿和餐饮业")>selected="selected"</#if> >商业、住宿和餐饮业</option>
                                        <option value="建筑业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="建筑业")>selected="selected"</#if> >建筑业</option>
                                        <option value="交通运输、仓储和邮政业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="交通运输、仓储和邮政业")>selected="selected"</#if> >交通运输、仓储和邮政业</option>
                                        <option value="信息传输、计算机和软件业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="信息传输、计算机和软件业")>selected="selected"</#if> >信息传输、计算机和软件业</option>
                                        <option value="金融、房地产、商务及居民服务业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="金融、房地产、商务及居民服务业")>selected="selected"</#if> >金融、房地产、商务及居民服务业</option>
                                        <option value="公共事业及管理组织" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="公共事业及管理组织")>selected="selected"</#if> >公共事业及管理组织</option>
                                        <option value="农、林、牧、渔业" <#if ((detailInfo.detailCategory)?? && detailInfo.detailCategory=="农、林、牧、渔业")>selected="selected"</#if> >农、林、牧、渔业</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="开户银行"/>开户银行</label>
                                <div class="col-md-9">
                                    <input type="text" id="bankName" name="bankName" value="${(detailInfo.bankName)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="开户名称"/>开户名称</label>
                                <div class="col-md-9">
                                    <input type="text" id="bankAccountName" name="bankAccountName" value="${(detailInfo.bankAccountName)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="开户账号"/>开户账号</label>
                                <div class="col-md-9">
                                    <input type="text" id="bankAccount" name="bankAccount" value="${(detailInfo.bankAccount)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="办公电话"/>办公电话</label>
                                <div class="col-md-9 input-group mar-btm">
                                    <input type="text" id="contactPhone" name="contactPhone" value="${(detailInfo.contactPhone)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="传真号码"/>传真号码</label>
                                <div class="col-md-9">
                                    <input type="text" id="fax" name="fax" value="${(detailInfo.fax)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <input type="hidden" id="detailId" name="detailId" value="${(detailInfo.id)!}" />
                            <input type="hidden" id="companyId" name="companyId" value="${(companyInfo.id)!}" />
                        </form>

                    </div>
                    <div class="col-lg-6">
                        <div class="panel-heading">
                            <h3 class="panel-title">企业订购信息</h3>
                        </div>
                        <form class="panel-body form-horizontal form-padding">
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="签约年限"/>签约年限</label>
                                <div class="col-md-9">
                                    <input type="text" id="tradeCycle" name="tradeCycle" value="${(contractInfo.tradeCycle)!}" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="生效时间"/>生效时间</label>
                                <div class="col-md-9">
                                    <input type="text" id="startAt" name="startAt" value="<#if (contractInfo.startAt)??>${contractInfo.startAt?string("yyyy-MM-dd")}</#if>" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="失效时间"/>失效时间</label>
                                <div class="col-md-9">
                                    <input type="text" id="endedAt" name="endedAt" value="<#if (contractInfo.endedAt)??>${contractInfo.endedAt?string("yyyy-MM-dd")}</#if>" class="form-control" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="套餐信息"/>套餐信息</label>
                                <div class="col-md-9">
                                        <#if (contractInfo.planType)?? && contractInfo.planType == 1>1:9分成
                                        <#elseif (contractInfo.planType)?? && contractInfo.planType == 2>全返
                                        <#else>
                                            <#if (contractSetting??)>
                                                <#if contractSetting.cooperationType == 1>
                                                    ${(100-(contractSetting.longAgreementRate)!0)/10}:${((contractSetting.longAgreementRate)!0)/10}分成
                                                <#elseif contractSetting.cooperationType == 2>
                                                保底 ${(contractSetting.bottomPrice)!}
                                                <#elseif contractSetting.cooperationType == 4>
                                                    ${(contractSetting.description)!}
                                                </#if>
                                            </#if>
                                        </#if>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="demo-email-input"><input type="checkbox" name="checkbox" value="备注"/>备注</label>
                                <div class="col-md-9">
                                    <textarea id="description" name="description" class="form-control" rows="3">${(contractSetting.description)!}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-12">
                                    <input type="hidden" id="contractId" name="contractId" value="${(contractInfo.id)!}" />
                                    <button type="button" class="btn btn-success" onclick="editInfo()">保存</button>
                                    <#if contractInfo?? && contractInfo.status != 2>
                                    <button type="button" class="btn btn-success" onclick="sendErrorMessages()">所选信息有误</button>
                                    <button type="button" class="btn btn-danger" onclick="messagePass()">通过</button>
                                    </#if>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </#if>
    <#if part="modal">
    </#if>

    <#if part="foot_script">
        <script src="<@spring.url "/resources/plugins/bootstrap-select/bootstrap-select.min.js"/>"></script>
        <#include "edit_js.ftl"/>
    </#if>

</@t.html>